﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PFileStreamWrite
{
    internal class Program
    {
        static void Main(string[] args)
        {
            try
            {
                FileStream afile = new FileStream("log.txt", FileMode.OpenOrCreate);
                StreamWriter SW = new StreamWriter(afile);
                bool truch = true;

                SW.WriteLine("第一行");
                SW.WriteLine(@"时间:{DateTime.Now.ToLongDateString()}");
                SW.WriteLine($"时间:{DateTime.Now.ToLongDateString()}");
                SW.WriteLine(truch);
                SW.Close();

            }
            catch (Exception a)
            {
                Console.WriteLine(a.Message);
                Console.ReadKey();
                return;
            }
        }
    }
}
